    //
//  detailViewController.m
//  ephemera
//
//  Created by Anna on 5/22/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "detailViewController.h"
#import "ephemeraAppDelegate.h"

@implementation detailViewController

@synthesize selectedHeadline, eDict, dImageView, dLabel, dTextView, iDict, blurbDict, dScrollView;



- (void)viewDidLoad {
	
	ephemeraAppDelegate *appDelegate = (ephemeraAppDelegate *)[[UIApplication sharedApplication] delegate];
	blurbDict = appDelegate.blurbDict;
	iDict = appDelegate.iDict;
	
	dLabel.text = selectedHeadline;
	dTextView.text = [blurbDict objectForKey:selectedHeadline];
	// [eDict objectForKey:selectedHeadline];
	dImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[iDict objectForKey:selectedHeadline]]];
	NSLog(@"imagepath: %@", [iDict	objectForKey:selectedHeadline]);
	dScrollView.contentSize = CGSizeMake(dImageView.frame.size.width, dImageView.frame.size.height);
	dScrollView.maximumZoomScale = 4.0;
	dScrollView.minimumZoomScale = 0.75;
	dScrollView.clipsToBounds = YES;
	dScrollView.delegate = self;
	[dScrollView addSubview:dImageView];
							   
    [super viewDidLoad];
}



- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    return YES;
}


- (UIView *)viewForZoomingInScrollView:(UIScrollView *)dScrollView{
	return dImageView;
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}


- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
	[dImageView release];
	[dScrollView release];
    [super dealloc];
}


@end
